package edu.mercer.sse554.bkp;

import java.util.Collection;

/**
 * Composite for Command.<p>
 *
 * Command Pattern: Composite.<br>
 * 
 * Interface for collection of Command leaves/children.<p>
 *
 * @param <A> - Generic bounded by Command
 * 
 * @param <B> - Generic bounded by CommandComposite. Suggested usage: self 
 * 	reference instance to this for fluent
 * 
 * @param <C> - Generic bounded by Collection. Collection containing Command
 * 	instances.
 */

public interface CommandComposite<A extends Command<?>,
								  B extends CommandComposite<?,?,?>,
								  C extends Collection<?>>
{
	/**
	 * Add a Command instance to CommandComposite collection.<p>
	 * 
	 * @param commandIn - Command instance to add to CommandComposite 
	 * 	collection
	 * 
	 * @return  CommandComposite reference to this
	 */
	
	B add( A command );

	
	/**
	 * Add collection of Command instance to CommandComposite's collection.
	 * <p>
	 * 
	 * @param commandCollection - Collection of Command instances to add to 
	 * 	CommandComposite's collection
	 * 
	 * @return  CommandComposite reference to this
	 */
	
	B add( C commandCollection );
	
	
	/**
	 * Remove a Command instance from CommandComposite collection.<p>
	 * 
	 * @param command - Command instance to remove from CommandComposite 
	 * 	collection
	 * 
	 * @return  CommandComposite reference to this
	 */
	
	B remove( A command );

	
	/**
	 * Retrieve a Command instance from CommandComposite collection using its 
	 * 	position.<p>
	 * 
	 * Integer index of Command instance within CommandComposite collections 
	 * 	is used for retrieval.<p>
	 * 
	 * @param childNumber - Integer index within collection
	 * 
	 * @return  Command retrieved from CommandComposite collection
	 */
		
	A getChild( Integer childNumber );

	
	/**
	 * Retrieve collection of Command instances.<p>
	 * 
	 * Suggested usage: Immutable collection/defensive copy.<p>
	 * 
	 * @return  Collection of Command instances
	 */
	
	C getChildren(); 

}//interface
